

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>试卷管理</title>
    <#include "/common/link.ftl">

</head>
<body class="hold-transition skin-black sidebar-mini">
<div class="wrapper">
    <#include "/common/navbar.ftl">
    <#assign currentMenu="exam"/>
    <#include "/common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>试卷编辑</h1>
        </section>
        <section class="content">
            <div class="box" style="padding: 10px">
                <form class="form-horizontal" action="/exam/createExam" method="post" id="editForm" >
                    <input type="hidden" name="id">
                    <div class="form-group"  style="margin-top: 10px;">
                        <label  class="col-sm-2 control-label">试卷名称：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control"
                                   name="title" placeholder="请输入试卷名称">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">考试时长：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control"
                                   name="examMinute" placeholder="请输入考试时长">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">单选题：</label>

                        <div class="col-sm-3">
                            <input type="text" class="form-control"
                                   name="radioNum" placeholder="请输入随机组题数量">
                        </div>

                        <div class="col-sm-3">
                            <input type="text" class="form-control"
                                   name="radioScore" placeholder="请输入每题分数">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">多选题：</label>

                        <div class="col-sm-3">
                            <input type="text" class="form-control"
                                   name="checkboxNum" placeholder="请输入随机组题数量">
                        </div>

                        <div class="col-sm-3">
                            <input type="text" class="form-control"
                                   name="checkboxScore" placeholder="请输入每题分数">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">判断题：</label>

                        <div class="col-sm-3">
                            <input type="text" class="form-control"
                                   name="judgeNum" placeholder="请输入随机组题数量">
                        </div>

                        <div class="col-sm-3">
                            <input type="text" class="form-control"
                                   name="judgeScore" placeholder="请输入每题分数">
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-2 control-label">试卷总分：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control"
                                   name="totalScore" placeholder="请输入试卷总分">
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-offset-6 col-sm-6">
                            <button type="button" class="btn btn-primary btn-submit btn-createExam">生成试卷</button>
                            <a href="javascript:window.history.back()" class="btn btn-danger">取消</a>
                        </div>
                    </div>

                </form>
            </div>
        </section>
    </div>
    <#include "/common/footer.ftl">
</div>
<script>
    $(function () {
        $(".btn-createExam").click(function () {
            Swal.fire({
                title: '确定生成试卷吗?',
                text: "生成后试卷内容无法修改!",
                icon: 'warning',
                showCancelButton: true,
                confirmButtonText: '确定',
                cancelButtonText: '取消'
            }).then((result) => {
                if (result.value) {
                   $("#editForm").ajaxSubmit(function (data) {
                       console.log(data);
                       if(data.success){
                           window.location.href = "/exam/list";
                       } else {
                           Swal.fire({
                               title: data.msg,
                               icon: 'error'
                           })
                       }
                   });
                }
            });
        });
    });
</script>
</body>
</html>
